#!/usr/bin/env python

from component import Console

from twisted.internet import reactor
from twisted.internet.protocol import ServerFactory

from _protocol import Protocol

class Factory(ServerFactory, Console):
    '''Factory class
    
    @author Julot <andy.julot@gmail.com>
    @since Wednesday, July 3, 2013. 17:38 PM'''
    
    clients = []
    protocol = Protocol
    checkTime = 300
    
    def run(self):
        reactor.callLater(self.checkTime, self.check)
    
    def check(self):
        for client in self.clients:
            client.checkConnection()
        reactor.callLater(self.checkTime, self.check)
